package com.mew.chess.core.game.pokdeng.game.common;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 百人牛牛
 */
public enum PokDengLinkType {

    Prepare(0),  // "准备游戏"),
    StartBet(1),   // "押注"),
    DealCard(2),  // "发牌"),
    AskCard(3),//洗牌
    MiCard(4),//咪牌
    OpenCard(5),//"开牌"
    Payment(6);  // "赔付");

    private final int code;

    PokDengLinkType(final int code) {
        this.code = code;
    }

    private final static Map<Integer, PokDengLinkType> stateMap
            = Arrays.stream(PokDengLinkType.values()).collect(Collectors.toMap(PokDengLinkType::code, code -> code));

    public int code() {
        return this.code;
    }


    public static PokDengLinkType parse(int code) {
        return stateMap.getOrDefault(code, PokDengLinkType.Prepare);
    }

}
